package me.yokeyword.fragmentation.helper.internal;

import ohos.utils.PacMap;
import ohos.utils.Parcel;
import ohos.utils.Sequenceable;

/**
 * @Hide Result 记录
 */
public final class ResultRecord implements Sequenceable {
    public int requestCode;
    public int resultCode = 0;
    public PacMap resultBundle;

    public ResultRecord() {
    }

    protected ResultRecord(Parcel in) {
        requestCode = in.readInt();
        resultCode = in.readInt();
        resultBundle = (PacMap)in.readValue();
    }

    public static final Producer<ResultRecord> PRODUCER = new Producer<ResultRecord>() {
        @Override
        public ResultRecord createFromParcel(Parcel in) {
            return new ResultRecord(in);
        }
    };

    @Override
    public boolean hasFileDescriptor() {
        return false;
    }

    @Override
    public boolean marshalling(Parcel parcel) {
        parcel.writeInt(requestCode);
        parcel.writeInt(resultCode);
        parcel.writeValue(resultBundle);
        return true;
    }

    @Override
    public boolean unmarshalling(Parcel parcel) {
        return true;
    }
}
